package com.manage.controller;

import com.clms.common.R;
import com.manage.pojo.entity.TbCoupon;
import com.manage.pojo.entity.TbMemberLevel;
import com.manage.pojo.vo.CouponVo;
import com.manage.pojo.vo.VipLevelVo;
import com.manage.service.CouponService;
import com.manage.service.VipLevelService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 优惠券控制层
 * @author: 林子洁
 * @create: 2021-07-23 14:42
 **/
@RestController
@RequestMapping("/manage/coupon")
public class CouponController {
    @Resource
    private CouponService couponService;
    @PostMapping("/initCoupon/{currentPage}/{pageSize}")
    public R initCoupon(@PathVariable("currentPage") Integer currentPage,
                        @PathVariable("pageSize") Integer pageSize,
                        @RequestBody CouponVo couponVo){
        return couponService.initCoupon(currentPage,pageSize,couponVo);
    }
    @PostMapping("/insertCoupon")
    public R insertCoupon(@RequestBody TbCoupon tbCoupon){
        return couponService.insertCoupon(tbCoupon);
    }
    @PutMapping("/updateCoupon")
    public R UpdateCoupon(@RequestBody TbCoupon tbCoupon){
        return couponService.updateCoupon(tbCoupon);
    }
    @DeleteMapping("/deleteCoupon/{id}")
    public R deleteCoupon(@PathVariable("id") Integer id){
        return couponService.deleteCoupon(id);
    }
    @PostMapping("/selectByCouponId/{id}")
    public R selectByCouponId(@PathVariable("id") Integer id){
        return couponService.selectByCouponId(id);
    }
    @GetMapping("/checkName")
    public R selectByName(@PathVariable("name") String name){
        return couponService.selectByName(name);
    }
}
